<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>Edit Discount | Merlion's ERP System</title>
    </ui:define>
    
    <ui:define name="content">
        
        <f:view beforePhase="#{editDiscountManagerBean.initView}">
        
        <h:form>                               
            <p:panel id="panel" header="Edit Discount"> 
                <p:ajaxStatus style="width:16px;height:16px;">   
                    <f:facet name="start">   
                        <p:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" /> 
                    </f:facet> 
 
                    <f:facet name="complete">   
                        <h:outputText value="" />   
                    </f:facet>   
                </p:ajaxStatus> 
 
                <p:messages /> 
 
                <h:panelGrid columns="3" cellpadding="10"> 
                    
                    <h:outputLabel for="discountId" style="font-weight: bold" value="Discount Id: " /> 
                    <h:outputText value="#{editDiscountManagerBean.discountToEdit.discountId}" id="discountId" />                                         
                    <p:message for="discountId" />  
                    
                    <h:outputLabel for="productType" style="font-weight: bold" value="Product Type: " /> 
                    <h:outputText value="#{editDiscountManagerBean.discountToEdit.productType}" id="productType"/>
                    <p:message for="productType" /> 
                    
                    <h:outputLabel for="lowerLimit" style="font-weight: bold" value="Lower Limit: " /> 
                    <p:inputText required="true" label="lowerLimit" requiredMessage="Lower Limit is required." id="lowerLimit" value="#{editDiscountManagerBean.discountToEdit.lowerLimit}"> 
                    </p:inputText> 
                    <p:message for="lowerLimit" /> 
 
                    <h:outputLabel for="higherLimit" style="font-weight: bold" value="Upper Limit: " /> 
                    <p:inputText required="true" label="higherLimit" requiredMessage="Upper Limit is required." id="higherLimit" value="#{editDiscountManagerBean.discountToEdit.higherLimit}"> 
                    </p:inputText> 
                    <p:message for="higherLimit" /> 
                    
                    <h:outputLabel for="discountRate" style="font-weight: bold" value="Discount rate: " /> 
                    <p:inputText required="true" label="discountRate" requiredMessage="Discount rate is required." id="discountRate" value="#{editDiscountManagerBean.discountToEdit.discountRate}"> 
                    </p:inputText> 
                    <p:message for="discountRate" /> 
                    
                </h:panelGrid>                
                <p:commandButton id="btn" value="Update Discount" update="panel" actionListener="#{editDiscountManagerBean.updateDiscount}" ajax="true" />
                <p:commandButton value="Clear" type="Reset"/>
            </p:panel> 
        </h:form>
            
        </f:view>
    </ui:define>

</ui:composition>
